package org.hongqi.common.senpec.sys.department;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Transient;
import lombok.*;
import org.hongqi.common.senpec.base.mybatisplus.IBaseEntity;
import org.hongqi.common.senpec.sys.user.User;

import java.util.Collection;

@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity(name = "senpec_sys_department")
@TableName("senpec_sys_department")
public class Department extends IBaseEntity<Department> {
    @Column(length = 30, nullable = false)
    private String label;
    private Long parent;
    private Boolean isRoot;
    private Long director;
    @Transient
    @TableField(exist = false)
    private Collection<Department> children;
    @Transient
    @TableField(exist = false)
    private Department parentObj;
    @Transient
    @TableField(exist = false)
    private User directorObj;
    @Transient
    @TableField(exist = false)
    private Long peopleCountAll = 0L;
    @Transient
    @TableField(exist = false)
    private Long peopleCountInCurrent = 0L;
}
